<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>编辑帖子</title>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/wangeditor@latest/dist/wangEditor.min.js"></script>
    <script type="text/javascript" src="../../js/editor/editPost.js"></script>
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <link rel="stylesheet" type="text/css" href="../../css/editor/editPost.css"/>
        <link rel="icon" type="image/x-icon" href="../../favicon.ico">
    <script>
        var c=()=>{
            let w=document.documentElement.clientWidth;/*获取设备宽度*/
            // let n=(20*(w/1500)>40?40+"px":(20*(w/1500)+"px"));
            let n=20*(w/1500);
            if (n>20){
                n=20+"px"
            }else if (n<20){
                n=20+"px"
            }else{
                n=n+"px"
            }
            document.documentElement.style.fontSize=n;
        }
        window.addEventListener("load",c);
        window.addEventListener("resize",c);
    </script>
</head>
<body>
<div id="outer">
<div id="body">
    <div id="head">
        <span class="headmes">主题</span>
        <select id="selectType" name="type">
            <option th:each="option:${optionList}" th:value="${option.tid}" th:text="${option.ptype}" th:selected="${post.ptype==option.ptype}"></option>
        </select>
        <span class="headmes">标题</span>
        <input id="title" type="text" name="title" placeholder="请输入标题" th:value="${post.ptitle}">
        <span id="titlemsg"></span>
    </div>

    <div id="div1"></div>

    <div id="tool">
        <button id="submit" class="button" type="button">发布帖子</button>
        <button id="draft1" class="button" type="button">另存为草稿</button>
        <button id="draft2" class="button" type="button">撤销发布并存为草稿</button>
        <span id="topMes">置顶</span>
        <input class="topCheck" id="topCheck" type="checkbox">
    </div>
    <textarea id="text"></textarea>
    <!--初始化储存post内容-->
    <textarea id="posttext" style="display: none" th:text="${post.pcontent}"></textarea>
    <!-- 底部其他信息显示 -->
    <div id="buttom">
    </div>
</div>
<!--获取url中的参数-->
<script>
    var args=new Object();
    var query=location.search.substring(1);//获取查询串
    var pairs=query.split(",");//在逗号处断开
    for(var i=0;i<pairs.length;i++){
        var pos=pairs[i].indexOf('=');//查找name=value
        if(pos==-1){//如果没有找到就跳过
            continue;
        }
        var argname=pairs[i].substring(0,pos);//提取name
        var value=pairs[i].substring(pos+1);//提取value
        args[argname]=unescape(value);//存为属性
    }
    // console.log("pid:"+args.pid);
</script>
</div>
</body>
</html>
